home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xfcn / spttool.cpt / Support Tools eXternals 1.2.5 / card_6308.txt < prev    next >
Text File  |  1990-11-13  |  5KB  |  153 lines

  1. -- card: 6308 from stack: in.5
  2. -- bmap block id: 7915
  3. -- flags: 0000
  4. -- background id: 3858
  5. -- name: AUXisRunning
  6. ----- HyperTalk script -----
  7. on HideObjects
  8.   hide cd btn "Try It!"
  9. end HideObjects
  10.  
  11. on ShowObjects
  12.   show cd btn "Try It!"
  13. end ShowObjects
  14.  
  15.  
  16. -- part 1 (button)
  17. -- low flags: 00
  18. -- high flags: A002
  19. -- rect: left=78 top=197 right=231 bottom=171
  20. -- title width / last selected line: 0
  21. -- icon id / first selected line: 0 / 0
  22. -- text alignment: 1
  23. -- font id: 0
  24. -- text size: 12
  25. -- style flags: 8192
  26. -- line height: 16
  27. -- part name: Try it!
  28. ----- HyperTalk script -----
  29. on mouseUp
  30.   if AUXIsRunning() then put "is" into isItRunning
  31.   else put "is not" into isItRunning
  32.   answer "A/UX" && isItRunning && "running."
  33. end mouseUp
  34.  
  35.  
  36.  
  37.  
  38. -- part contents for background part 20
  39. ----- text -----
  40.      Indicates whether A/UX (Apple's UNIX operating system) is currently running or not.  This information is especially useful for code which won't work under one operating system or another.  For instance   A/UX uses the slash "/" as the directory separator in path names whereas Mac OS uses the colon":".
  41.  
  42.      Returns "TRUE" or "FALSE".
  43.  
  44.      Calling Syntax: AUXIsRunning()
  45.  
  46.  
  47.  
  48. -- part contents for background part 38
  49. ----- text -----
  50. 5/50
  51.  
  52. -- part contents for background part 42
  53. ----- text -----
  54. { AUXIsRunning()                          }
  55. { XFCN returns true or false, reporting whether A/UX is   }
  56. { running or not.                            }
  57. { ┬⌐ Apple Computer, 1989, 1990.  All rights reserved.    }
  58. { written by Anup Murarka                    }
  59. {}
  60. {  brought to you by:  Anup Murarka      Eric Carlson    }
  61. {            ALINK:  SKEPTIC      ALINK:  cyNic  }
  62. {                  CIS:  76004,3356    }
  63. {}
  64. {        We are part of the Support Tools Development Group,  }
  65. {        Apple Computer, Inc.   }
  66. {}
  67. {        please DO NOT contack Mac DTS for support of this code!  }
  68. {}
  69. {        please DO contact the authors for support of this code!  }
  70. {}
  71. {        Send comments, bug reports, requests to any of the above  }
  72. {        E-mail addresses or to:}
  73. {}
  74. {              (one of us)          }
  75. {              Apple Computer, Inc.     }
  76. {              900 E. Hamilton, Ave.    }
  77. {              Campbell, CA   95008    }
  78. {              M/S 72-L          }
  79. {}
  80. { modification history                      }
  81. {       Date        Initials                  Comments              }
  82. {       ----        ------  ------------------------------------------------------}
  83. {    2/14/90      akm    first written                              }
  84. {}
  85.  
  86. unit AUXIsRunning;
  87.  
  88. interface
  89.  
  90.   uses
  91.     XCmdIntf, XCMDUtils;
  92.  
  93.   procedure MAIN (paramPtr: XCmdPtr);
  94.  
  95. implementation
  96.  
  97.   procedure AUXisRunning (paramPtr: XCmdPtr);
  98.   FORWARD;
  99.  
  100.   procedure MAIN (paramPtr: XCmdPtr);
  101.   begin
  102.     AUXisRunning(paramPtr);
  103.   end;
  104.  
  105.   function BitTest (AddressToCheck: ptr;
  106.                   TotalBits: integer;
  107.                   BitToTest: longint): boolean;
  108.   { function that allows caller to use std. 68000 bit notation instead of the Toolbox's reversed notation}
  109.   { example:  bit 0 (the least significant bit) in a byte is bit 7 in the Toolbox's notation}
  110.   begin
  111.     BitTest := BitTst(AddressToCheck, TotalBits - 1 - BitToTest);
  112.   end;
  113.  
  114.   function AskedForHelp (paramPtr: XCmdPtr;
  115.                   syntaxMsg: Str255;
  116.                   copyRightMsg: Str255): boolean;
  117. {}
  118. {  check to see if the user sent a '?' or a '!' as }
  119. { the only parameter. if so we will respond with }
  120. { the calling syntax or the copyright/version info }
  121. { for this external }
  122. {}
  123.     var
  124.       firstStr: str255;
  125.   begin
  126.     askedForHelp := false;
  127.     if paramPtr^.paramCount = 1 then
  128.       begin
  129.         ZeroToPas(paramPtr, paramPtr^.params[1]^, firstStr);
  130.           { what is the first param? }
  131.         if firstStr = '?' then
  132.           begin
  133.             paramPtr^.returnValue := PasToZero(paramPtr, syntaxMsg);
  134.             askedForHelp := true
  135.           end  { asked for help }
  136.         else if firstStr = '!' then
  137.           begin
  138.             paramPtr^.returnValue := PasToZero(paramPtr, copyRightMsg);
  139.             askedForHelp := true
  140.           end;  { asked for copyright info }
  141.       end;  { one parameter passed }
  142.   end;  { function }
  143.  
  144.   procedure AUXisRunning (paramPtr: XCmdPtr);
  145. { if A/UX is currently active bit nine of the long at $B22 (2850) is set }
  146. {  if Mac OS is running, the bit is clear }
  147.     const
  148.       HWCfgFlag = $0B22;
  149.   begin
  150.     if not askedForHelp(paramPtr, 'AUXIsRunning()', 'v1.0, ┬⌐1989, 1990 Apple Computer, Inc.,  Anup Murarka') then
  151.       paramPtr^.returnValue := PasToZero(paramPtr, BoolToStr(paramPtr, BitTest(pointer(HWCfgFlag), 16, 9)));
  152.   end;
  153. end.